package com.example.teesystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.teesystem.entity.WrongSet;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author NieYaShi
 * @description 针对表【t_wrong_set】的数据库操作Mapper
 * @createDate 2022-04-07 15:04:19
 * @Entity com.example.teesystem.entity.WrongSet
 */
@Mapper
public interface WrongSetMapper extends BaseMapper<WrongSet> {
    @Select("select * from t_wrong_set where student_id = #{studentId} and issue_id = #{issueId} and is_delete = 0")
    WrongSet getWrongSetByStuIdAndIssueId(Integer studentId, Integer issueId);

    @Delete("update t_wrong_set set is_delete = 1 where id = #{id}")
    void deleteWrongSet(Integer id);

    @Delete("update t_wrong_set set is_delete = 1, num = 3 where id = #{id}")
    void autoDeleteWrongSet(Integer id);

    @Select("select issue_id from t_wrong_set where id = #{id} and is_delete = 0")
    int getIssueIdById(Integer id);
}




